#encoding:utf-8
'''
Created on 2015��6��15��

@author: Doris
'''

import subprocess
import sys
from optparse import OptionParser


adbPath="E:\\Android\\android-sdk-windows\\platform-tools\\adb.exe" #Adbλ��


data  = subprocess.Popen (adbPath+" devices", stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell = True) #����adb devices

print data.stdout.read()

if(len(sys.argv[1:])==0):
    sys.exit();





parser = OptionParser()
parser.add_option("-p","--path",action="store",type="string",dest="path",help="the Apk file path")
parser.add_option("-d","--devices",action="store",type="string",dest="devices",default="71MBBL622NQF",help="list all the emulator")
(options,args)=parser.parse_args()


apkPath=options.path 


cmd=adbPath+" -s "+options.devices+" install "+apkPath
data  = subprocess.Popen (cmd, stdout=subprocess.PIPE,
        stderr=subprocess.PIPE, shell = True)



print data.stdout.read()   

